<template>
  <div>
    <div class="auxiliary">
      <div class="auxiliary-title">辅助工具</div>
      <div class="auxiliary-main">
        <div
          class="auxiliary-option"
          @click="activeTool(item.icon)"
          v-for="item in options"
          :key="item.icon"
        >
          <Icon
            :title="item.title"
            :name="item.icon"
            :font-size="iconSize"
          />
          <span>{{ item.title }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Icon from '@/components/icon'

export default {
  props: {
    options: {
      type: Array,
      default: () => []
    }
  },
  components: {
    Icon
  },
  data() {
    return {
      iconSize: 20
    }
  },
  methods: {
    activeTool(icon) {
      this.$emit('changeActive', icon)
    }
  }
}
</script>

<style lang="scss" scoped>
.auxiliary {
  box-shadow: 0 0 8px 0 #057595;
  border-radius: 8px;
  word-break: keep-all;

  &-title {
    height: 40px;
    line-height: 40px;
    text-align: center;
    background: rgba(2, 27, 43, 0.8);
    font-size: 14px;
    font-weight: 800;
    color: #fefefe;
    border-radius: 8px 8px 0 0;
  }

  &-main {
    padding: 4px 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: rgba(25, 59, 81, 1);
    border-radius: 0 0 8px 8px;
  }

  &-option {
    font-size: 14px;
    font-weight: 400;
    color: #fff;
    display: flex;
    align-items: center;

    &:not(:first-child) {
      margin-top: 6px;
    }

    & > span:nth-child(2) {
      margin-left: 4px;
      cursor: pointer;
    }
  }
}
</style>
